

#ifndef DEVICEMANAGER_H
#define DEVICEMANAGER_H

#include "DXGI.h"
#include "D3D11.h"

class DeviceManager
{
private:
	DeviceManager();
public:
	static DeviceManager* CreateDevice(int width,int height,bool fullscreen,HWND handle);
	bool Resize(int width,int height);
	void SetViewport(int width, int height);
	void RestoreTarget();
	void Clear(float r,float g,float b,float a);
	void Present();
	void Release();
	int GetWidth();
	int GetHeight();

	ID3D11Device* mpDevice;
	ID3D11DeviceContext* mpContext;
	IDXGISwapChain* mpSwapChain;
	ID3D11Texture2D* mpBackBuffer;
	ID3D11RenderTargetView* mpRenderTargetView;
	ID3D11DepthStencilView* mpRenderTargetDepth;   

private:
	bool CreateTargetView();
	bool CreateDepthStencilView(int width,int height);

	ID3D11DepthStencilState* mpDepthState;
	ID3D11RasterizerState* mpRasterState;
	ID3D11SamplerState* mpSamplerState;
	ID3D11BlendState* mpBlendState;

	bool mIsFullscreen;
	int mWidth;
	int mHeight;
};

#endif